﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    public class Date : global::Xtee.Core.Schema.XsdString {
        
        public Date(string value) : 
                base(value) {
            this.Pattern = @"(([0-2]?[0-9])|(3[0,1]))\.((0[0-9])|(1[0-2]))\.[0-9]{4}";
            this.Validate();
        }
        
        public Date() : 
                base(string.Empty) {
        }
        
        public static bool TryParse(string value, out global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.Date result) {
            try {
                result = new global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.Date(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator String (Date value) {
            return value.Value;
        }
        
        public static implicit operator Date (string value) {
            if (value==null) {
                return null;
            }
            return new Date(value);
        }
    }
}
